package com.dongdongshop.service.impl;


import com.dongdong.pojo.TbContent;
import com.dongdong.pojo.TbContentExample;
import com.dongdong.service.ContentService;
import com.dongdongshop.mapper.TbContentMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
@com.alibaba.dubbo.config.annotation.Service
public class  ContentServiceImpl implements ContentService {

    @Autowired
    private TbContentMapper contentMapper;

    @Override
    public List<TbContent> selectAll() {
        List<TbContent> contents = contentMapper.selectAll();
//        contentMapper.selectByExample(null);
        return contents;
    }

    @Override
    public boolean insert(TbContent tbContent) {
        int i = contentMapper.insertSelective(tbContent);
        return i > 0;
    }


    @Override
    public boolean delete(Long id) {
        int i = contentMapper.deleteByPrimaryKey(id);
        return i > 0;
    }

    @Override
    public TbContent selectId(Long id) {
        TbContent content = contentMapper.selectByPrimaryKey(id);
        return content;
    }

    @Override
    public boolean update(TbContent tbContent) {
        int i = contentMapper.updateByPrimaryKeySelective(tbContent);
        return i > 0;
    }

    @Override
    public boolean updateSID(TbContent tbContent) {
        int i = contentMapper.updateByPrimaryKeySelective(tbContent);
        return i > 0;
    }

    @Override
    public List<TbContent> selectcID(Long id) {
        List<TbContent> contents = contentMapper.selectCid(id);
        return contents;
    }


}
